﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
public partial class Control_InsertTravelPlanControl : System.Web.UI.UserControl
{
    private string stime = null;
    private string etime = null;
    protected void Page_Load(object sender, EventArgs e)
    {
        calender.SelectedDate = DateTime.Now;
        calender.StartDate = DateTime.Now;
    }
    ListAndProcessData ws = new ListAndProcessData();
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        
        if ((DropDownList2.SelectedItem).ToString().Equals("") && (DropDownList4.SelectedItem).ToString().Equals(""))
        {
             stime = (DropDownList1.SelectedItem).ToString() + ":00";
             etime = (DropDownList3.SelectedItem).ToString() + ":00";
        }
        else
        {
             stime = (DropDownList1.SelectedItem).ToString() + ":" + (DropDownList2.SelectedItem).ToString();
             etime = (DropDownList3.SelectedItem).ToString() + ":" + (DropDownList4.SelectedItem).ToString();
        }
        
        Boolean a = false;
        a = ws.InsertTravelPlan(txtSlocation.Text, txtELocation.Text,txtstartdate.Text, stime +" > "+ etime);
        if (a == true)
        {
            Response.Redirect("../Admin/ShowTravelPlan_Admin.aspx");

        }
        else
        {
            Response.Redirect("Default3.aspx");
        }
    }
    protected void btnreset_Click(object sender, EventArgs e)
    {
        
    }
}